<template>
  <view class="complaint_warrp">
    <z-paging ref="paging" v-model="list" class="notice-list" @query="getComplaintList">
      <template #top>
        <cus-tab v-model="tabId"></cus-tab>
      </template>

      <view class="list-cons" >
        <list-cons v-model="tabId" :dataInfo="dataInfo"></list-cons>
      </view>
      <!-- <none-page
        v-else
        :isIndex="false"
        :imgUrl="imgUrl"
        imgStyle="width: 480rpx;height: 600rpx;"
      >
        <view class="none_tips">暂无数据</view>
      </none-page> -->
      <view class="create_btn" @click="gotoSkip">新建留言</view>
    </z-paging>
  </view>
</template>

<script>
import ZPaging from "../../uni_modules/z-paging/components/z-paging/z-paging.vue";
import cusTab from "./components/cus-tab.vue";
import nonePage from "@/components/none-page/none-page.vue";
import listCons from "./components/list-cons.vue";
import { getByStudent } from "../../api/index";
export default {
  components: {
    cusTab,
    nonePage,
    listCons,
  },
  data() {
    return {
      tabId: 0,
      dataInfo: {
    
        count: 2,
      },
      pageInfo: {
        page: 1,
        limit: 10,
      },
      isNext: true,
      imgUrl: require("static/none_icon.png"),
    };
  },
  onLoad() {
    this.getComplaintList(true);
  },
  watch: {
    tabId(news) {
      this.getComplaintList(true);
    },
  },
  methods: {
    gotoSkip() {
      uni.navigateTo({
        url: "/pages/complaint/complaint?type=2",
      });
    },
    async getComplaintList(flag) {
      if (flag) {
        this.pageInfo = {
          pageNum: 1,
          pageSize: 10,
        };
      }
      let info = { ...this.pageInfo };
      let res = await getByStudent(info);
      this.dataInfo.list = res.rows;
      console.log(this.dataInfo, "wwwww");
			this.$refs.paging.complete(res.rows);
    },
  },

  onReachBottom() {
    if (this.isNext) {
      this.pageInfo.pageNum++;
      this.getComplaintList(false);
    }
  },
};
</script>

<style lang="scss" scoped>
.complaint_warrp {
  width: 100%;
  background: #f5f6f9;
  min-height: 100vh;
}
.none_tips {
  color: #979db3;
  text-align: center;
  font-family: PingFang SC;
  font-size: 14px;
  font-style: normal;
  font-weight: 500;
  margin-top: 80rpx;
  line-height: 14px; /* 100% */
}
.list-cons {
  width: 100%;
  padding: 24rpx 32rpx;
  padding-bottom: 240rpx;
  box-sizing: border-box;
}
.create_btn {
  width: 470rpx;
  height: 88rpx;
  border-radius: 6px;
  background: #5475ff;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #fff;
  text-align: center;
  font-family: PingFang SC;
  font-size: 14px;
  font-style: normal;
  font-weight: 500;
  line-height: 14px;
  position: fixed;
  bottom: 120rpx;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
}
</style>
